<?php

namespace app\admin\controller;
use app\api\logic\TrackLogic;
use app\common\controller\PCBase;
use app\common\controller\DBase;
use think\facade\Db;
use  think\facade\Request;
use  app\admin\logic\TestLogic;
use  app\order\logic\OrderShipLogic;
use  app\customer\logic\TikMessageLogic;
use  think\App;
class TestOrder extends DBase
{

    /**
     * @desc   测试
     * @author xx
     * @date   2024-05-14
     */
    public function getWhOrder(){
        $data   = $this->request->post();
        $res    = (new TestLogic())->get_conversations_list($data);
        return $this->jsonMessage(200, true, "获取成功!",$res);
    }



    /**
     * @desc   获取IM会话内容
     * @author xx
     * @date   2024-05-17
     */
    public function getIMConversations(){
        $data   = $this->request->get();
        $res    = (new TestLogic())->get_all_shop_conversations();
        return $this->jsonMessage(200, true, "获取成功!",$res);
    }


    /**
     * @desc   获取IM会话消息
     * @author xx
     * @date   2024-05-17
     */
    public function getIMConversationsMess(){
        $data   = $this->request->post();
        $res    = (new TestLogic())->get_conversations_mess($data);
        return $this->jsonMessage(200, true, "获取成功!",$res);
    }




    /**
     * @desc   消息变更为已读
     * @author xx
     * @date   2024-05-19
     */
    public function messages_read_operate()
    {
        $data   = $this->request->post();
        $res    = (new TestLogic())->messages_read_operate($data);
        return $this->jsonMessage(200, true, "操作成功!",$res);
    }


    /**
     * @desc   消息变更为已读
     * @author xx
     * @date   2024-05-19
     */
    public function getIMConversationsMessProduce()
    {
        $data   = $this->request->post();
        $res    = (new TestLogic())->getIMConversationsMessProduce();
        return $this->jsonMessage(200, true, "操作成功!",$res);
    }



    /**
     * @desc   每天下午4点定时去拉取
     * 美国0点之前产生的数据用于群发消息
     * @author luckyXiong
     * @date   2024-05-24
     */
    public function getBatchSendOrder(){
        $data   = $this->request->get();
        $res    = (new TestLogic())->get_batch_send_order($data);
        return $this->jsonMessage(200, true, "获取成功!",$res);
    }



    /**
     * @desc    sku信息
     * @author  luckyXiong
     * @date    2024-05-29
     */
    public function get_sku_info_consumer()
    {
        $data   = $this->request->post();
        $res    = (new TestLogic())->get_sku_info($data);
        return $this->jsonMessage(200, true, "操作成功!",$res);
    }


    /**
     * @desc    会话消息已读回复
     * @author  luckyXiong
     * @date    2024-05-31
     */
    public function get_read_message()
    {
        $data   = $this->request->post();
        $res    = (new TikMessageLogic())->change_message_read();
        return  $this->jsonMessage(200, true, "操作成功!",$res);
    }


    /**
     * @desc    会话消息已读回复
     * @author  luckyXiong
     * @date    2024-05-31
     */
    public function conversations_read_consumer()
    {
        $data   = $this->request->post();
        $res    = (new TrackLogic())->conversations_read_queue($data);
        return  $this->jsonMessage(200, true, "操作成功!",$res);
    }



    /**
     * @desc    异常订单重新发货处理到999
     * @author  luckyXiong
     * @date    2024-06-03
     */
    public function mandatoryShipping()
    {
        $params = $this->request->post();
        $orderShipLogic = new OrderShipLogic();
        $status         = $params['status']??'';
        if($status == 6){
            return  $orderShipLogic->mandatorySplitShipping($params);
        }else{
            return  $orderShipLogic->mandatoryShipping($params);
        }
    }














}